/* 
 * File:   string_funcs.h
 * Author: BuzzW
 *
 * Created on April 1, 2012, 5:10 PM
 */

#ifndef STRING_FUNCS_H
#define	STRING_FUNCS_H
#include <sstream>
#include <string>

using namespace std;

template <class T>
bool from_String(T& t,
const std::string& s,
std::ios_base& (*f)(std::ios_base&)) {
    std::istringstream iss(s);
    return !(iss >> f >> t).fail();
}

template<class T>
inline string to_String(const T &obj) {
    stringstream s;
    s << obj;
    return s.str();
}

#endif	/* STRING_FUNCS_H */

